Batman was recently betrayed by his ally Mr. Freeze after stealing his lychee gelato (don't do this kids!). In his rage, Mr. Freeze froze Batman's head solid with his freeze gun. Eventually, Batman thawed but he had lost a few of his basic skills, including the ability to order things lexicographically. Batman knew his only option was to get his much smarter butler, Alfred, to write some code to do it for him. Alfred needs to write code which takes in a number N and prints out all N! permutations of the letter "a" through the Nth letter in the alphabet in lexicographic order (lowercase).
Input Format
A single positive integer representing N, the numerical position of a letter in the alphabet (a is 1). All N! permutations of the letter a through the above letter must be computed. These permutations must use all letters "a" through the Nth letter.
Sample Input
3
Output Format All N! permutations of the letter a through the Nth letter in the alphabet must be printed out in lexicographic order (lowercase).
Sample Output
abc
acb
bac
bca
cab
cba
You must be logged in to submit a solution.